#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

void printh(string nums, int k, short *parts)
{
    int i, j;
    for (i = 0; i < nums.size(); i++)
    {
        cout << " ";
        for (j = 0; j < k; j++)
        {
            cout << (parts[nums[i] - '0'] ? "-" : " ");
        }
        cout << " ";
        if (i < (nums.size() - 1)) cout << " ";
    }
}

void printv(string nums, int k, short *parts)
{
    int i, j, t, l;
    for (i = 0; i < k; i++)
    {
        for (j = 0; j < nums.size(); j++)
        {
            t = parts[nums[j] - '0'];
            if (t == 1 || t ==3) 
                cout << "|";
            else 
                cout << " ";

            for (l = 0; l < k; l++) cout << " ";
            
            if (t == 2 || t ==3) 
                cout << "|";
            else 
                cout << " ";

            if (j < (nums.size() - 1)) cout << " ";
        }
        if (i != k - 1) cout << "\n"; 
    }
}

int main(int argc, char const *argv[])
{
    short parts[][10] = 
    {
        // 1表示上边有横线
        { 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 },
        // 1表示左边有横线，2表示右边有横线，3表示都有
        { 3, 2, 2, 2, 3, 1, 1, 2, 3, 3 },
        // 1表示中间有横线
        { 0, 0, 1, 1, 1, 1, 1, 0, 1, 1 },
        // 1表示左边有横线，2表示右边有横线，3表示都有
        { 3, 2, 1, 2, 2, 2, 3, 2, 3, 2 },
        // 1表示下边有横线
        { 1, 0, 1, 1, 0, 1, 1, 0, 1, 1}
    };

    string nums;
    int k, n, i, j, l, t;

    cin >> k >> nums;

    // 输出上面的横线
    printh(nums, k, parts[0]);
    cout << "\n";
    // 输出上面的竖线
    printv(nums, k, parts[1]);    
    cout << "\n";
    // 输出中间的横线
    printh(nums, k, parts[2]);
    cout << "\n";
    // 输出下面的竖线
    printv(nums, k, parts[3]);    
    cout << "\n";
    // 输出下面的横线
    printh(nums, k, parts[4]);
    return 0;
}
